﻿{include file="public/header"/}

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>
	首页 <span class="c-gray en">&gt;</span>商家管理 <span class="c-gray en">&gt;</span>商家列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="page-container">
	<!--<div class="cl pd-5 bg-1 bk-gray mt-20">-->
		<!--<span class="l">-->
				<!--<a href="javascript:;" onclick="businessAdd('添加商家','businessAdd','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加商家</a>-->
		<!--</span>-->
	<!--</div>-->
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="80">ID</th>
				<th width="100">用户名</th>
				<th width="40">性别</th>
				<th width="90">手机</th>
				<th width="150">邮箱</th>
				<th width="150">地址</th>
				<th width="130">加入时间</th>
				<th width="70">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>

		</tbody>
	</table>
	</div>
</div>
{include file="public/footer"/}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$(function(){
	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
		]
	});
	
});
/*用户-添加*/
function businessAdd(title,url,w,h){
	layer_show(title,url,w,h);
}
/*用户-查看*/
function businesShow(title,url,id,w,h){
	layer_show(title,url,w,h);
}

/*用户-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}


/*商家-删除*/
function businesDel(obj,id){
    layer.confirm('确认要删除吗？',function(index){
        $.ajax({
            type: 'POST',
            data:{"id":id},
            url: 'businesDel',
            dataType: 'json',
            success: function(data){
                if (data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除！',{icon:1,time:1000});
                    setTimeout('window.location.reload()',1000);
                }
                if (data.code == 403){
                    layer.msg('删除失败！',{icon:2,time:1000});
                    setTimeout('window.location.reload()',1000);
                    return false;
                }
            },
        });
    });
}

/*商家-停止使用*/
function businesStop(obj,id,state) {
    var title = "已停用";
    if (state == 0) {
        state = 1;
        title = "已停用！";
    } else if (state == 1) {
        state = 0;
    }
    layer.confirm('确认要停止使用吗？',function (index) {
        $.ajax({
            type: "post",
            data: {"id":id,"state":state},
            url: "businesActive",
            dataType: "json",
            // async: false,
            success: function (data) {
                if (data) {
                    // $(obj).parents("tr").remove();
                    layer.msg(title , {icon: 5});
                    setTimeout('window.location.reload()',1000);
                } else {
                    layer.msg(title + '失败', {icon: 2});
                    setTimeout('window.location.reload()',1000);
                }
            }
        });
    });
}

/*商家-审核*/
function businesStart(obj,id,state) {
    var title = "已审核！";
    if (state == 0) {
        state = 1;
        title = "已审核";
    } else if (state == 1) {
        state = 0;
    }
    layer.confirm('确认要通过审核吗？',function (index) {
        $.ajax({
            type: "post",
            data: {"id":id,"state":state},
            url: "businesActive",
            dataType: "json",
            // async: false,
            success: function (data) {
                if (data) {
                    // $(obj).parents("tr").remove();
                    layer.msg(title , {icon: 6});
                    setTimeout('window.location.reload()',1000);
                } else {
                    layer.msg(title + '失败', {icon: 2});
                    setTimeout('window.location.reload()',1000);
                }
            }
        });
    });
}

</script> 
</body>
</html>